#include"thread_pool.h"
#include<time.h>
#include<cstdlib>

void test_log()
{
    l.enable(0);
    l.Log_infom(Debug,"haha %d,i am %s,what is %f",37,"cr",3.7);
    l.Log_infom(Debug,"haha %d,i am %s,what is %f",37,"cr",3.7);
    l.Log_infom(Debug,"haha %d,i am %s,what is %f",37,"cr",3.7);
    l.Log_infom(Info,"haha %d,i am %s,what is %f",37,"cr",3.7);
    l.Log_infom(Warning,"haha %d,i am %s,what is %f",37,"cr",3.7);
    l.Log_infom(Error,"haha %d,i am %s,what is %f",37,"cr",3.7);
    l.Log_infom(Fatal,"haha %d,i am %s,what is %f",37,"cr",3.7);
}
void publish(const string& name)
{
    thread_pool<task> tp;
    srand(time(nullptr));
    while(1)
    {
        int x=rand()%101;
        int y=rand()%101;
        char operat=operates[rand()%sizeof(operates)];
        task t(x,y,operat);
        cout<<name<<": ";
        t.print_task_start();
        tp.push(t);
        sleep(1);
    }
}
int main()
{
    thread t(publish,"thread_0");
    t.join();//线程等待

    return 0;
}